<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
  <link rel="stylesheet" href="../css/public.css" media="all">
  <style>
    .echarts-records {
      margin-top: 50px;
      width: 100%;
      min-height: 600px
    }
  </style>
</head>

<body>
  <div class="layuimini-container">
    <div class="layuimini-main">

      <fieldset class="table-search-fieldset">
        <legend>搜索信息</legend>
        <div style="margin: 10px 10px 10px 10px">
          <form class="layui-form layui-form-pane" action="">
            <div class="layui-form-item">
              <div class="layui-inline">
                <label class="layui-form-label">粮仓列表</label>
                <div class="layui-input-inline">
                  <select name="modules">
                    <option value="1">一号仓</option>
                    <option value="2">二号仓</option>
                    <option value="3">三号仓</option>
                  </select>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-inline">
                  <input type="text" class="layui-input" id="test1" placeholder="yyyy-MM-dd">
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                  <input type="text" class="layui-input" id="test2" placeholder="yyyy-MM-dd">
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">分层</label>
                <div class="layui-input-inline">
                  <select>
                    <option value="1">一层</option>
                    <option value="2">二层</option>
                    <option value="3">三层</option>
                  </select>
                </div>
              </div>
              <div class="layui-inline">
                <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i
                    class="layui-icon"></i> 查 询</button>
              </div>
            </div>
          </form>
        </div>
      </fieldset>

      <div id="echarts-records" class="echarts-records"></div>
    </div>
  </div>
  <script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
  <script src="../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
  <script>
    layui.use(['form', 'table', 'echarts'], function () {
      var $ = layui.jquery,
        form = layui.form,
        laydate = layui.laydate,
        table = layui.table,
        echarts = layui.echarts;

      laydate.render({
        elem: '#test1'
      });

      laydate.render({
        elem: '#test2'
      });


      // 监听搜索操作
      form.on('submit(data-search-btn)', function (data) {
        var result = JSON.stringify(data.field);

        return false;
      });

      /**
         * 报表功能
         */
      var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
      var optionRecords = {
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: ['粮温']
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          feature: {
            saveAsImage: {}
          }
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          nameTextStyle: {
            fontSize: 16,
          },
          data: ['1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10']
        },
        yAxis: {
          type: 'value',
          name: '℃',
          nameTextStyle: {
            fontSize: 16,
          }
        },
        series: [
          {
            name: '粮温',
            type: 'line',
            data: [5.67, 5.57, 5.45, 5.28, 5.16, 5.12, 5.09, 4.96,4.54,4.17]
          },
        ]
      };
      echartsRecords.setOption(optionRecords);
      // echarts 窗口缩放自适应
      window.onresize = function () {
        echartsRecords.resize();
      }

    });
  </script>

</body>

</html>